package xyz.xtt.asset.utils;

import java.math.BigDecimal;
import java.util.Objects;

/**
 * @author huqibo
 * @date 2024/12/20
 */
public class BigDecimalUtils {
	/**
	 * >= 0
	 * 
	 * @param value
	 * @return
	 */
	public static boolean isGreaterThanZero(BigDecimal value) {
		return Objects.nonNull(value) && value.compareTo(BigDecimal.ZERO) >= 0;
	}

	/**
	 * 等于1
	 * 
	 * @param value
	 * @return
	 */
	public static boolean isEqualOne(BigDecimal value) {
		return Objects.nonNull(value) && value.compareTo(BigDecimal.ONE) == 0;
	}

	public static boolean isGreater(BigDecimal value) {
		return Objects.nonNull(value) && value.compareTo(BigDecimal.ZERO) > 0;
	}

	/**
	 * 目标值是否大于1
	 * 
	 * @param value
	 * @return
	 */
	public static boolean isGreaterOne(BigDecimal value) {
		return Objects.nonNull(value) && value.compareTo(BigDecimal.ONE) > 0;
	}

	public static void main(String[] args) {
		boolean greaterThanZero = isGreaterThanZero(new BigDecimal("0"));
		System.out.println("greaterThanZero:\t" + greaterThanZero);
	}

}
